package com.emn.fil.defifil.candidats;
//Lehec killian

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.emn.fil.defifil.iface.IDefi1;


public class DefiTriKik implements IDefi1 {
	
	 private static List<Integer> numbers;
	 private static int number;
	
public List<Integer> trier(List<Integer> listNbs, List<Integer> listNbsExclus)
{
	
	Collections.sort(listNbs);
	listNbs = SupprDoublons(listNbs);
	Collections.sort(listNbsExclus);
	//listNbsExclus = SupprDoublons(listNbsExclus);
	
	listNbs = SupprExclus(listNbs, listNbsExclus);
	
	
return listNbs;
}

 
  
  public static List<Integer> SupprDoublons(List<Integer> listNbs)
	{
	
		List<Integer> result = new ArrayList<Integer>();
		Integer tmp = listNbs.get(0);
		result.add(tmp);
		for (Integer x : listNbs){
			if(tmp!=x){
				result.add(x);
			}
		tmp = x;
		}	
	return result;
	}
	
	public static List<Integer> SupprExclus(List<Integer> listNbs, List<Integer> listNbsExclus){
		
		List<Integer> result = new ArrayList<Integer>();
		for (Integer x : listNbs){
			
			if(Collections.binarySearch(listNbsExclus, x)<0){
				result.add(x);
			}
			
		}
		
		return result;
		
	}
	
	


}
